import cv2
import numpy as np

# 二值化的处理一定基于灰度化（单通道图）
# 灰度化
gray = cv2.imread("./img/color.png", 0)

# binary 得到的二值化图像
# ret 本次二值化的阈值 127
ret, binary = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)

cv2.imshow("img", binary)
cv2.waitKey(0)
